﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CdcSoftware.Pivotal.Applications.Core.Client;
using System.Data;
using CdcSoftware.Pivotal.Applications.Core.Common;
using CdcSoftware.Pivotal.Engine.Client.Services.Interfaces;
using CdcSoftware.Pivotal.Engine.UI.Forms;


namespace Pcm.Retail.Client.FormTasks
{
    //public partial class RE_Line_Of_Business : FormClientTask
    //{
    //    #region Constructor
    //    /// <summary>
    //    /// Default constructor where secondary fields are being initialized to be used across assembly
    //    /// </summary>
    //    public RE_Line_Of_Business()
    //    {

    //    }
    //    #endregion

    //    public override void OnFormInitialized()
    //    {
    //        try
    //        {
    //            Globals.RemoveButtonBarButton(new string[] { "Save", "Apply", "Cancel", "Delete", "Refresh" });
    //            this.FormView.OnDirtyStateChanged += new EventHandler<Microsoft.Practices.CompositeUI.Utility.DataEventArgs<bool>>(FormView_OnDirtyStateChanged);
    //            SharedLoad();
                
    //        }
    //        catch (Exception exc)
    //        {
    //            Globals.HandleException(exc, true);
    //        }
    //    }

    //    public override void OnFormReloaded()
    //    {
    //        try
    //        {
    //            base.OnFormReloaded();
    //            SharedLoad();
    //        }
    //        catch(Exception ex)
    //        {
    //            Globals.HandleException(ex, true);
    //        }
    //    }

    //    private void FormView_OnDirtyStateChanged(object sender, Microsoft.Practices.CompositeUI.Utility.DataEventArgs<bool> e)
    //    {
    //        this.FormView.Dirty = false;
    //    }

    //    private void SharedLoad()
    //    {
    //        try
    //        {
    //            if (!Convert.IsDBNull(this.PrimaryDataRow["Agreement_Number"]))
    //            {
    //                Globals.EnableDisableAllPrimaryFields(false);
    //            }
    //            else
    //            {
    //                if (String.Equals(TypeConvert.ToString(this.PrimaryDataRow["Source_"]), "Town Stores"))
    //                {
    //                    Globals.EnableDisableAllPrimaryFields(false);
    //                }
    //                else
    //                {
    //                    if (String.Equals(TypeConvert.ToString(this.PrimaryDataRow["RAE_Transaction"]), "CancelAEOrder"))
    //                    {
    //                        Globals.EnableDisablePrimaryFields(false, new string[] { "Contact_First_Name", "Contact_Last_Name", "Contact_Email",
    //                         "Date_of_Purchase"});
    //                        ((PivotalTextBox)this.FormControl.GetControlByDataName("Contact_First_Name")).Required = false;
    //                        ((PivotalTextBox)this.FormControl.GetControlByDataName("Contact_Last_Name")).Required = false;
    //                        ((PivotalTextBox)this.FormControl.GetControlByDataName("Contact_Email")).Required = false;
    //                        ((PivotalTextBox)this.FormControl.GetControlByDataName("Date_of_Purchase")).Required = false;
    //                    }
    //                    else
    //                    {
    //                        Globals.EnableDisablePrimaryFields(true, new string[] { "Contact_First_Name", "Contact_Last_Name", "Contact_Email",
    //                        "Date_of_Purchase"});
    //                        ((PivotalTextBox)this.FormControl.GetControlByDataName("Contact_First_Name")).Required = true;
    //                        ((PivotalTextBox)this.FormControl.GetControlByDataName("Contact_Last_Name")).Required = true;
    //                        ((PivotalTextBox)this.FormControl.GetControlByDataName("Contact_Email")).Required = true;
    //                        ((PivotalTextBox)this.FormControl.GetControlByDataName("Date_of_Purchase")).Required = true;
    //                    }
    //                }
    //            }
    //        }
    //        catch (Exception ex)
    //        {
    //            Globals.HandleException(ex, true);
    //        }
    //    }
    //}
}
